package com.driver.model;

import javax.servlet.*;
import javax.servlet.http.*;
import org.json.JSONArray;
import org.json.JSONException;




import java.io.*;
import java.util.List;

public class CarDriverPathServletAndroid extends HttpServlet {
    public void doGet(HttpServletRequest rq, HttpServletResponse rp) 
    				throws ServletException, IOException{
    	
    	String cardriverJsonStr=null;
    	CarDriverPathDAO cardriverPathDAO= new CarDriverPathDAO();
   
    	List<CarDriverPathVO> driverpath = cardriverPathDAO.getAll();
    	
    	
    	
    	CarDriverPathJsonHandler cardriverJsonHandler =new CarDriverPathJsonHandler();
    	cardriverJsonStr=cardriverJsonHandler.toJSONArray(driverpath).toString();
    
        rp.setContentType("text/html; charset=utf-8");
        PrintWriter out = rp.getWriter();
        out.println(cardriverJsonStr); 
        out.close();
    }
    public void doPost(HttpServletRequest rq, HttpServletResponse rp) 
    				throws ServletException, IOException{
        doGet(rq, rp); 
    }
}